package com.qinglei.recoup.system.manager.adapter.impl;


import com.qinglei.recoup.common.domain.RadarVersionEnum;
import com.qinglei.recoup.system.manager.adapter.RadarVersionAdapter;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author: 最爱学英语的cxd
 * @slogan: 一入代码深似海，从此红尘是路人
 * @create: 2022-05-05
 **/
@Component
public class RadarVersionFactory {

    @Resource
    private RadarV7Adapter radarV7Adapter;

    @Resource
    private RadarV4Adapter radarV4Adapter;

    @Resource
    private RadarV3Adapter radarV3Adapter;

    private final Map<RadarVersionEnum, RadarVersionAdapter> allAdapter = new ConcurrentHashMap<>();

    @PostConstruct
    private void put() {
        allAdapter.put(RadarVersionEnum.VERSION_V7, radarV7Adapter);
        allAdapter.put(RadarVersionEnum.VERSION_V4, radarV4Adapter);
        allAdapter.put(RadarVersionEnum.VERSION_V3, radarV3Adapter);
    }

    public RadarVersionAdapter get(RadarVersionEnum radarVersionEnum) {
        return allAdapter.get(radarVersionEnum);
    }


}
